import { axios as request } from '@/utils/request'

const clientAPI = {
  // https://pv.sohu.com/cityjson?ie=utf-8'
  getIpInfoFromSohu: 'sohuApi/cityjson?ie=utf-8',
  // https://www.taobao.com/help/getip.php
  getIpFromTaoBao: 'taobaoApi/help/getip.php',
  // https://ip.taobao.com/service/getIpInfo.php?ip=115.159.152.210
  getIpInfoFromTaoBao: 'taobaoApi/service/getIpInfo.php',
}

export function getIpInfoFromSohuRequest(parameters) {
  return request({
    // baseURL: 'https://pv.sohu.com',
    // url: process.env.NODE_ENV === 'production' ? 'cityjson?ie=utf-8' : clientAPI.getIpInfoFromSohu,
    url:  clientAPI.getIpInfoFromSohu,
    method: 'get',
    data: parameters,
  })
}

export function getIpFromTaoBaoRequest(parameters) {
  return request({
    url: clientAPI.getIpFromTaoBao,
    method: 'get',
    data: parameters,
  })
}

export function getIpInfoFromTaoBaoRequest(parameters) {
  return request({
    url: clientAPI.getIpInfoFromTaoBao,
    method: 'get',
    data: parameters,
  })
}

